package com.example.modulepicselector;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Set;

public final class MyMatisse {
    private final WeakReference<Activity> mContext;
    private final WeakReference<Fragment> mFragment;


    private MyMatisse(Activity activity) {
        this(activity, null);
    }


    private MyMatisse(Fragment fragment) {
        this(fragment.getActivity(), fragment);
    }

    private MyMatisse(Activity context, Fragment fragment) {
        this.mContext = new WeakReference<>(context);
        this.mFragment = new WeakReference<>(fragment);
    }

    public static MyMatisse from(Activity activity) {
        return new MyMatisse(activity);
    }

    public static MyMatisse from(Fragment fragment) {
        return new MyMatisse(fragment);
    }

    public static List<Uri> obtainResult(Intent data) {
//        return data.getParcelableArrayListExtra(MyMatisseActivity.EXTRA_RESULT_SELECTION);
        return null;
    }

    public static List<String> obtainPathResult(Intent data) {
//        return data.getStringArrayListExtra(MatActivity.EXTRA_RESULT_SELECTION_PATH);
        return null;
    }


    public MySelectionCreator choose() {
        return new MySelectionCreator(this);
    }




    @Nullable
    Activity getActivity() {
        return mContext.get();
    }

    @Nullable
    Fragment getFragment() {
        return mFragment != null ? mFragment.get() : null;
    }
}
